<?php
class IndexAction extends HomeAction{
	public function index(){


		$Activity = M('Activity');
		$field = "activity.*,user.username,user.sex";
		$where = "1 AND activity.state=1";
		$order = "activity.create_time DESC";
		$join = "LEFT JOIN `user` ON user.uid=activity.uid";
		$list = $Activity->where($where)->limit('5')->join($join)->field($field)->order($order)->select();
		foreach($list as &$v){
			$v['thumb'] = array_shift(json_decode($v['scenic_images']));
		}
		$Participation = M('participation');
		$list_1=array_slice($list,0,2);
		$list_2=array_slice($list,2,5);
		$this->assign('list_1',$list_1);
		$this->assign('list_2',$list_2);
		
		$this->display();
	}
}
?>